package com.ciaojian.worker.controller;

import com.ciaojian.core.mapper.OrderCommissionMapper;
import com.ciaojian.core.mapper.WorkerCostCountMapper;
import com.ciaojian.core.model.WorkerCostCount;
import com.ciaojian.core.model.vo.SalesProfitVo;
import com.ciaojian.core.util.Result;
import com.ciaojian.worker.model.param.BadCommentParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @author oxiny
 */
@Api(tags = "员工: 警告!")
@RestController
@RequestMapping("/warning")
public class WorkerCostCountController {

    @Resource
    private WorkerCostCountMapper WorkerCostCountMapper;

    @ApiOperation("发型师差评订单")
    @GetMapping("/getList")
    public Result getWarnings(@RequestParam(required = false) Integer workerId,
                              @DateTimeFormat(pattern = "yyyy-MM") Date date) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
        String month = dateFormat.format(date);
        List<WorkerCostCount> workerCostCounts = WorkerCostCountMapper.getWarnings(workerId,month);

        return Result.ok(workerCostCounts);
    }

}
